package tema8.ej05.controller;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import tema8.ej05.model.PersonaDAO;
import tema8.ej05.model.bo.Persona;

/**
 * Servlet implementation class PaisRecuperarController
 */
@WebServlet("/PersonaRecuperar")
public class PersonaRecuperarController extends HttpServlet {
	private static final long serialVersionUID = 1L;

	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		PersonaDAO personaDAO = new PersonaDAO();
		List<Persona> personas = personaDAO.recuperarPersonas();
		request.setAttribute("personas", personas);
		request.getRequestDispatcher("/tema8/ej05/personaRecuperar.jsp")
				.forward(request, response);
		;
	}

	protected void doPost(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
